import {request} from '@/common/js/request'
import {msg} from "@/common/js/util.js"
export default {
	data(){
		return {
			dataList: [],
			active: 5,
			gold: ''
		}
	},
	methods:{
		async open() {
			console.log(1111)
			try{
				const res = await request('user/sign-in-list', { uid: uni.getStorageSync('uid') });
				console.log(res)
				if (res.data.result == 0) {
					this.dataList = res.data.dataList;
					this.signIn();
				} else {
					msg(res.resultNote);
				}
			}catch(e){
				//TODO handle the exception
				console.log(e)
			}
			
		},
		async signIn() {
			const res = await request('user/sing-in', { uid: uni.getStorageSync('uid') });
			console.log(res)
			if (res.data.result == 0) {
				this.active = res.data.data.day - 1;
				this.gold = this.dataList[this.active].gold;
			} else {
				msg(res.resultNote);
			}
		}
	}
}